<?php

declare(strict_types=1);

namespace Modules\Salesmanagement\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
 * @property $salesout_id
 * @property $fid
 * @property $fseq
 * @property $fentryid
 * @property $fmaterialid
 * @property $fmaterialname
 * @property $fmaterialmodel
 * @property $fmodel
 * @property $funitid_number
 * @property $funitid_name
 * @property $fqty
 * @property $fstockid_number
 * @property $fstockid_name
 * @property $fmemo
*/
class SalesoutAttached extends Model
{
    

    protected $table = 'salesout_attached';

    protected $fillable = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'salesout_id', 'fid', 'fseq', 'fentryid', 'fmaterialid', 'fmaterialname', 'fmaterialmodel', 'fmodel', 'funitid_number', 'funitid_name', 'fqty', 'fstockid_number', 'fstockid_name', 'fmemo' ,'fownertypeid','fownerid_number' ,'fownerid_name'];

    /**
     * @var array
     */
    protected array $fields = ['id','created_at','updated_at','salesout_id','fid','fseq','fentryid','fmaterialid','fmaterialname','fmaterialmodel','fmodel','funitid_number','funitid_name','fqty','fstockid_number','fstockid_name','fmemo','fownertypeid','fownerid_number' ,'fownerid_name'];

    /**
     * @var array
     */
    protected array $form = ['created_at','updated_at','salesout_id','fid','fseq','fentryid','fmaterialid','fmaterialname','fmaterialmodel','fmodel','funitid_number','funitid_name','fqty','fstockid_number','fstockid_name','fmemo','fownertypeid','fownerid_number' ,'fownerid_name'];

   

     
    /**
     * @var array
     */
    public array $searchable = [
        'fmaterialid' => 'like',
        'fmaterialname' => 'like',
        'fmaterialmodel' => 'like',
    ];
   
/**
     * 链表查询
     */
    public function detailscheckOne()
    {
        return $this->hasOne(Salesout::class);//查一条
        // return $this->hasOne(Stash::class,'id','owning_id');
    }

    public function detailscheckAll()
    {
        return $this->hasMany(Salesout::class);//查多条
    }



   
    //输出相应的时间格式
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }
  



    
}
